{extend name="base"}
{block name="style"}
<!-- 这里允许在引入一些样式头部 -->
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="{:_static()}/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="//at.alicdn.com/t/font_tnyc012u2rlwstt9.css" media="all" />
	<link rel="stylesheet" href="{:_static()}/css/todaySituation.css" media="all" />
<link rel="stylesheet" href="{:_static()}/css/common.css" media="all" />

{/block}

{block name="main"}
<style type="text/css">
	.ws-main{padding: 15px;}
	a:hover{color: inherit !important;}
</style>

	<div class="layui-form">
	  <div class="row row1">
	  		<div class="filter">
		  		<div class="tab-head">
			    	<label class="layui-form-label" style="box-sizing: content-box;"><strong>当前情况统计</strong></label>
			    </div>
			    <div class="tab-body">
			    	<div class="tab-cont">
			    		<span>暂无数据</span>
			    	</div>
			    </div>
		    </div>
    	</div>
    	<div class="row row2">
	  		<div class="filter">
		  		<div class="tab-head">
			    	<label class="layui-form-label" style="box-sizing: content-box;"><strong>好友获取记录</strong></label>
				    <div class="layui-input-block">
				    	<span class="filter-menu"><input class="filter-item" type="radio" name="select" value="今天" title="今天" checked=""></span>
				      	<span class="filter-menu"><input class="filter-item" type="radio" name="select" value="昨天" title="昨天" ></span>
				      	<span class="filter-menu"><input class="filter-item" type="radio" name="select" value="前天" title="前天" ></span>
				    </div>
			    </div>
			    <div class="tab-body">
			    	<div class="tab-cont">
			    		<span>暂无数据</span>
			    	</div>
			    </div>
		    </div>
    	</div>
	</div>
	<div id="page"></div>


<script type="text/babel" type="text/javascript">
layui.config({
	// base : "js/"
}).use(['form','layer','jquery','laypage'],function(){
	var form = layui.form(),
		layer = parent.layer === undefined ? layui.layer : parent.layer,
		laypage = layui.laypage,
		$ = layui.jquery;


	//添加设备
	$(".deviceAdd_btn").click(function(){
		layer.prompt({title: '添加设备'}, function(val, index){
		  // layer.msg('得到了'+val);
		  layer.close(index);
		});
	})

	//全选
	form.on('checkbox(allChoose)', function(data){
		var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]:not([name="show"])');
		child.each(function(index, item){
			item.checked = data.elem.checked;
		});
		form.render('checkbox');
	});

	//通过判断文章是否全部选中来确定全选按钮是否选中
	form.on("checkbox(choose)",function(data){
		var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]:not([name="show"])');
		var childChecked = $(data.elem).parents('table').find('tbody input[type="checkbox"]:not([name="show"]):checked')
		if(childChecked.length == child.length){
			$(data.elem).parents('table').find('thead input#allChoose').get(0).checked = true;
		}else{
			$(data.elem).parents('table').find('thead input#allChoose').get(0).checked = false;
		}
		form.render('checkbox');
	})

	//是否展示
	form.on('switch(isShow)', function(data){
		var index = layer.msg('修改中，请稍候',{icon: 16,time:false,shade:0.8});
        setTimeout(function(){
            layer.close(index);
			layer.msg("展示状态修改成功！");
        },2000);
	})
 
	//操作
	$("body").on("click",".news_edit",function(){  //编辑
		layer.alert('您点击了文章编辑按钮，由于是纯静态页面，所以暂时不存在编辑内容，后期会添加，敬请谅解。。。',{icon:6, title:'文章编辑'});
	})

	$("body").on("click",".news_collect",function(){  //收藏.
		if($(this).text().indexOf("已收藏") > 0){
			layer.msg("取消收藏成功！");
			$(this).html("<i class='layui-icon'>&#xe600;</i> 收藏");
		}else{
			layer.msg("收藏成功！");
			$(this).html("<i class='iconfont icon-star'></i> 已收藏");
		}
	})

	$("body").on("click",".news_del",function(){  //删除
		var _this = $(this);
		layer.confirm('确定删除此信息？',{icon:3, title:'提示信息'},function(index){
			//_this.parents("tr").remove();
			for(var i=0;i<newsData.length;i++){
				if(newsData[i].newsId == _this.attr("data-id")){
					newsData.splice(i,1);
					newsList(newsData);
				}
			}
			layer.close(index);
		});
	})


})

</script>
{/block}